﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="PC_ChangeStore.aspx.cs" Inherits="PMS.WaitDealUI.PC_ChangeStore" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <%--<script type="text/javascript">
        $(function () {
            var height = $("#divTotal").height();
            var master = $("#master").height();
            var content = parseFloat(height) - parseFloat(master) - 30;
            $("#tbList").css("height", content);
        });
        function decodeUTF8(str) {
            return str.replace(/(\\u)(\w{4}|\w{2})/gi, function ($0, $1, $2) {
                return String.fromCharCode(parseInt($2, 16));
            });
        }
        function Utf8ToGb2312(str1) {
            var substr = "";
            var a = "";
            var b = "";
            var c = "";
            var i = -1;
            i = str1.indexOf("%");
            if (i == -1) {
                return str1;
            }
            while (i != -1) {
                if (i < 3) {
                    substr = substr + str1.substr(0, i - 1);
                    str1 = str1.substr(i + 1, str1.length - i);
                    a = str1.substr(0, 2);
                    str1 = str1.substr(2, str1.length - 2);
                    if (parseInt("0x" + a) & 0x80 == 0) {
                        substr = substr + String.fromCharCode(parseInt("0x" + a));
                    }
                    else if (parseInt("0x" + a) & 0xE0 == 0xC0) { //two byte
                        b = str1.substr(1, 2);
                        str1 = str1.substr(3, str1.length - 3);
                        var widechar = (parseInt("0x" + a) & 0x1F) << 6;
                        widechar = widechar | (parseInt("0x" + b) & 0x3F);
                        substr = substr + String.fromCharCode(widechar);
                    }
                    else {
                        b = str1.substr(1, 2);
                        str1 = str1.substr(3, str1.length - 3);
                        c = str1.substr(1, 2);
                        str1 = str1.substr(3, str1.length - 3);
                        var widechar = (parseInt("0x" + a) & 0x0F) << 12;
                        widechar = widechar | ((parseInt("0x" + b) & 0x3F) << 6);
                        widechar = widechar | (parseInt("0x" + c) & 0x3F);
                        substr = substr + String.fromCharCode(widechar);
                    }
                }
                else {
                    substr = substr + str1.substring(0, i);
                    str1 = str1.substring(i);
                }
                i = str1.indexOf("%");
            }
            return substr + str1;
        }

    </script>--%>
    <script type="text/javascript">

        $(function () {
            var DealId = com.get.DealId;
            //var planTrackId = com.get.waitParams;
            //// console.log(planTrackId);
            //$("#demandInfoId").val(planTrackId);
            $("#tbList").datagrid({
                url: '/Logic/CommonAjax/WaitDealAjax.aspx?method=CommonWaitDealList',
                loadMsg: '数据加载中请稍后……',
                fitColumns: true,
                rownumbers: true,
                idField: "ID",
                singleSelect: false,
                queryParams: { DealId: DealId },
                striped: true,
                frozenColumns: [[{ field: 'ck', checkbox: true, width: 30 },
                 { field: 'ID', title: 'ID ', align: "center" },
                 //{ field: 'DemandPlanId', title: '计划主表ID ', align: "center" },
                 { field: 'DemandPlanInfoId', title: '计划分表ID ', align: "center" },
                 { field: 'PlanTrackId', title: '计划跟踪号 ', align: "center" },
                 { field: 'Tuhao', title: '图号/标识号 ', align: "center" },
                 { field: 'MaterialCode', title: '物料编码 ', align: "center" },
                 { field: 'MaterialName', title: '物料名称 ', align: "center" }, ]],
                columns: [[
                 { field: 'MaterialGuige', title: '规格 ', align: "center" },
                 { field: 'MaterialCaizhi', title: '材质 ', align: "center" },
                 { field: 'MaterialGB', title: '国标 ', align: "center" },
                 { field: 'MaterialType', title: '材料类型 ', align: "center" },
                 { field: 'MaterialLength', title: '长 ', align: "center" },
                 { field: 'MaterialWidth', title: '宽 ', align: "center" },
                 { field: 'DemandNum', title: '需用数量 ', align: "center" },
                 { field: 'DemandAidNum', title: '需用辅助数量 ', align: "center" },
                 { field: 'ChangeDemNum', title: '变更需用数量 ', align: "center" },
                 { field: 'ChangeDemAidNum', title: '变更辅助数量 ', align: "center" },
                 { field: 'ChangeNote', title: '变更备注 ', align: "center" },
                 { field: 'ChangeDate', title: '变更日期 ', align: "center" },
                 { field: 'ChangerName', title: '变更人 ', align: "center" },
                 { field: 'StoreName', title: '储运人 ', align: "center" },
                 { field: 'PurchaserName', title: '采购员 ', align: "center" },
                 {
                     field: 'ChangeSate', title: '状态', align: "center", formatter: function (value, row, Index) {
                         return com.getArrayText(StaticCombo.PcChangeState, value);
                     }
                 }]]
            });
        });
        //处理变更数据
        //同意
        function Agree() {
            var rows = $("#tbList").datagrid("getSelections");
            if (rows.length > 0) {
                var oId = { changeInfo: JSON.stringify(rows) };
                com.ajax({
                    url: "/Logic/PC/PC_ChangeAjax.aspx?method=AgreeChangeSm",
                    data: oId,
                    success: function (data) {
                        com.message('success', data.msg, function () {
                            $("#tbList").datagrid("reload");
                            $("#tbList").datagrid("unselectAll");
                        });
                    }
                });
            }
            else { com.message("information", "请至少选择一条数据"); }
        }
        //不同意
        function DisAgree() {
            var rows = $("#tbList").datagrid("getSelections");
            if (rows.length > 0) {
                var oId = { changeInfo: JSON.stringify(rows) };
                com.ajax({
                    url: "/Logic/PC/PC_ChangeAjax.aspx?method=DisAgreeChangeSm",
                    data: oId,
                    success: function (data) {
                        com.message('success', data.msg, function () {
                            $("#tbList").datagrid("reload");
                            $("#tbList").datagrid("unselectAll");
                        });
                    }
                });
            }
            else { com.message("information", "请至少选择一条数据"); }
        }
        function funcSearch() {
            var para = com.serializeSearchArray("form1");
            $("#tbList").datagrid("load", para);
            if ($("#ChangeState").combobox('getValue') == 0) {
                $('#btnAgree').linkbutton('enable');
                $('#btnDisAgree').linkbutton('enable');
            }
            else {
                $('#btnAgree').linkbutton('disable');
                $('#btnDisAgree').linkbutton('disable');
            }
        }
        function funcReload() {
            $("#form1").form("reset");
            var para = com.serializeSearchArray("form1");
            $("#tbList").datagrid("load", para);
            $('#btnAgree').linkbutton('enable');
            $('#btnDisAgree').linkbutton('enable');
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
    <a href="javascript:void(0)" id="agree" class="easyui-linkbutton" onclick="Agree()"
        data-options="iconCls:'icon-tick',plain:true">同意</a> &nbsp;&nbsp;
    <a href="javascript:void(0)" id="disagree" class="easyui-linkbutton" onclick="DisAgree()"
        data-options="iconCls:'icon-undo',plain:true">不同意</a> &nbsp;&nbsp;
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <%-- <div id="divTotal" style="height: 100%; width: 100%">
        <div id="master" class="container_16" style="height: auto">
            <form id="form1">
                <div class="grid_2 sealbl" style="text-align: right;">
                    计划跟踪号:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="PlanTrackId" name="PlanTrackId" data-cp="co" />
                    <input type="hidden" id="demandInfoId" value="0" data-cp="=" />
                </div>
                <div class="grid_2 sealbl" style="text-align: right;">
                    物料名称:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="MaterialName" name="MaterialName" data-cp="co" />
                </div>
                <div class="grid_2 sealbl" style="text-align: right;">
                    物料编码:
                </div>
                <div class="grid_2 seaval" style="text-align: left;">
                    <input type="text" id="MaterialGuige" name="MaterialGuige" data-cp="co" />
                </div>
                <div class="grid_2 sealbl" style="text-align: right;">
                    类型:
                </div>
                <%--   <div class="grid_2 seaval" style="text-align: left;">
                    <input id="MaterialType" name="MaterialType" data-cp="=" class="easyui-combobox" value="0" data-options="valueField:'value',textField:'text',data:StaticCombo.PcDemandPlanState,panelHeight:'auto',editable:false" />
                </div>--%>

    <%--  </form>
        </div>
        
        <div id="DemandPlanChangeDiv">
        </div>
    </div>--%>
    <table id="tbList" title="需用计划变更表" style="width: 100%; height: 360px">
    </table>
</asp:Content>
